package io.renren.modules.mybog.fromControoler;




import io.renren.modules.mybog.entity.FriendEntity;
import io.renren.modules.mybog.fromControoler.utiles.R;
import io.renren.modules.mybog.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小🌤
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/bolg/friend")
public class FriendControllers {
    @Autowired
    private FriendService friendService;

    @GetMapping("/list")
    public R list(){
     List<FriendEntity> friends= friendService.ListStatus();
        return R.ok().data("friend",friends);
    }
    @PostMapping("/save")
    public R save(@RequestBody(required = false) FriendEntity friend){
        boolean save = friendService.save(friend);
        return save?R.ok():R.error();
    }
}

